VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "comctl32.ocx"
Begin VB.Form frmChoose 
   Caption         =   "Select Wallpaper"
   ClientHeight    =   6255
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5280
   Icon            =   "frmChoose.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   417
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   352
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdStop 
      Caption         =   "Stop"
      Height          =   255
      Left            =   3480
      TabIndex        =   7
      Top             =   75
      Width           =   1695
   End
   Begin VB.PictureBox picSrc 
      AutoRedraw      =   -1  'True
      AutoSize        =   -1  'True
      Height          =   855
      Left            =   1800
      ScaleHeight     =   795
      ScaleWidth      =   1035
      TabIndex        =   6
      Top             =   2040
      Visible         =   0   'False
      Width           =   1095
   End
   Begin VB.PictureBox picThumb 
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000005&
      Height          =   1152
      Left            =   240
      ScaleHeight     =   73
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   98
      TabIndex        =   5
      Top             =   840
      Visible         =   0   'False
      Width           =   1536
   End
   Begin VB.Frame fraChoose 
      Height          =   5535
      Left            =   0
      TabIndex        =   3
      Top             =   375
      Width           =   5295
      Begin ComctlLib.ListView flb 
         Height          =   5295
         Left            =   60
         TabIndex        =   4
         Top             =   150
         Width           =   5175
         _ExtentX        =   9128
         _ExtentY        =   9340
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         _Version        =   327682
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   1
         NumItems        =   0
      End
      Begin ComctlLib.ImageList imgList 
         Left            =   0
         Top             =   0
         _ExtentX        =   1005
         _ExtentY        =   1005
         BackColor       =   -2147483643
         MaskColor       =   12632256
         _Version        =   327682
      End
   End
   Begin ComctlLib.StatusBar stsChoose 
      Align           =   2  'Align Bottom
      Height          =   300
      Left            =   0
      TabIndex        =   2
      Top             =   5955
      Width           =   5280
      _ExtentX        =   9313
      _ExtentY        =   529
      SimpleText      =   ""
      _Version        =   327682
      BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} 
         NumPanels       =   1
         BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
            AutoSize        =   1
            Object.Width           =   8811
            Object.Tag             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.CommandButton cmdView 
      Caption         =   "View Wallpaper"
      Height          =   255
      Left            =   1800
      TabIndex        =   1
      Top             =   75
      Width           =   1575
   End
   Begin VB.CommandButton cmdSelect 
      Caption         =   "Select Wallpaper"
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   75
      Width           =   1575
   End
End
Attribute VB_Name = "frmChoose"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As String, ByVal fuWinIni As Long) As Long
Const SPIF_UPDATEINIFILE = &H1
Const SPI_SETDESKWALLPAPER = 20
Const SPIF_SENDWININICHANGE = &H2

Private Const TXT_STOP As String = "Stop"
Private Const TXT_GO As String = "Refresh"

Dim showThumb As clsShowThumb

Private Sub cmdSelect_Click()
    Call flb_DblClick
End Sub

Private Sub cmdStop_Click()
    If cmdStop.Caption = TXT_STOP Then
        showThumb.stopThumb = True
        cmdStop.Caption = TXT_GO
    Else
        showThumb.stopThumb = True
        cmdStop.Caption = TXT_STOP
        Set showThumb = New clsShowThumb
        Call showThumb.Imposta
        Call showThumb.GeneraThumb
        'Set showThumb = Nothing
    End If
End Sub

Private Sub cmdView_Click()
    Dim FileName As String
    FileName = App.Path & Current_wallpaper_dir & flb.SelectedItem.Text
    ShellExecute frmChoose.hwnd, "", FileName, "", FileName, 0
End Sub

Private Sub flb_DblClick()
    Dim Temp As String
    Dim FilePath As String
    FilePath = App.Path & Current_wallpaper_dir & flb.SelectedItem.Text
    picSrc.Picture = LoadPicture(FilePath)
    SavePicture picSrc, App.Path & WALLPAPER_DEFAULT_NAME
    Temp = App.Path & WALLPAPER_DEFAULT_NAME
    SystemParametersInfo SPI_SETDESKWALLPAPER, 0&, Temp, SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE
End Sub

Private Sub Form_Load()
    Set showThumb = New clsShowThumb
    Me.Show
    Call showThumb.Imposta
    Call showThumb.GeneraThumb
    'Set showThumb = Nothing
End Sub

Private Sub Form_Resize()
    On Error Resume Next
    fraChoose.Width = ScaleX(frmChoose.Width, vbTwips, vbPixels) - 8
    fraChoose.Height = ScaleY(frmChoose.Height, vbTwips, vbPixels) - fraChoose.top - stsChoose.Height - 28
    flb.Width = ScaleX(fraChoose.Width, vbPixels, vbTwips) - 120
    flb.Height = ScaleY(fraChoose.Height, vbPixels, vbTwips) - flb.top - 80
End Sub

